<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>模拟博客园登录</title>
</head>
<%
    //获取cookie信息进行免登录操作
    Cookie[] cookies = request.getCookies();
    String blogUser = null;
    if(cookies!=null){
        for (int i = 0; i < cookies.length; i++) {
            if(cookies[i].getName().equals("blogUser")){
                blogUser = cookies[i].getValue();
                break;
            }
        }
        //判断值
        if (blogUser!=null){
            response.sendRedirect("welcome.jsp");
        }

    }
%>
<body>
<h1>登录演示保存cookie</h1>
<form action="doLogin3.jsp" method="post">
    <p>用户名：<input type="text" name="username"></p>
    <p>密码：<input type="password" name="password"></p>
    <p><input type="submit" value="登录"></p>
</form>



</body>
</html>
